package com.tarena.micro.service.cart.consumer;

import com.tarena.micro.service.cart.service.CartService;
import com.tarena.micro.service.pojo.message.CartDeleteMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class CartDeleteConsumer {
    @Autowired
    private CartService cartService;
    @RabbitListener(queues = "cart_delete")
    public void cartDelete(CartDeleteMessage message){
        log.info("接收到删除购物车参数:{}",message);
        cartService.deleteCart(message.getProductCode(),message.getUserId());
    }
}
